import Vue from 'vue'
import App from './App.vue'
import './assets/font/iconfont.css'
import router from './router'
import store from './store'

Vue.config.productionTip = false

import { Form,FormItem,Input,Button,Select,Option,Message, Container,
  Header,
  Aside,
  Main,
  Menu,
  MenuItem,
  Table,
  TableColumn,
  Icon,
  Drawer,
  DatePicker,
  TimePicker,
  Pagination,
  Upload,
  Tabs,
  TabPane
 } from 'element-ui'

Vue.use( Form );
Vue.use( FormItem );
Vue.use( Input );
Vue.use( Button );
Vue.use( Select );
Vue.use( Option );
Vue.use( Container );
Vue.use( Header );
Vue.use( Aside );
Vue.use( Main );
Vue.use( Menu );
Vue.use( MenuItem );
Vue.use( Table );
Vue.use( TableColumn );
Vue.use( Icon );   //icon图
Vue.use( Drawer ); //抽屉
Vue.use(  DatePicker ); //日期
Vue.use(  TimePicker ); //时间
Vue.use(  Pagination ); //分页
Vue.use(  Upload ); //上传文件
Vue.use(  Tabs ); //上传文件
Vue.use(  TabPane ); //上传文件

Vue.prototype.$message = Message;

//过滤路由表, 过滤并生成该用户有权限访问的路由
//将最终生成的 该用户有权限访问的路由 动态添加到公共路由表中.
if( store.state.userinfo.role && store.state.userinfo.role.permissions ){
  router.addRoutes( store.getters.getRoutes );
}
new Vue({
  router,
  store, //将store对象挂载到根实例上, 在所有组件中都可以通过 this.$store 获取store对象, 进而可以获取store对象身上 的 commit() dispatch()  getters , state
  render: h => h(App)
}).$mount('#app')
